/**
 * 
 */
package com.admin.his.common.dto;

import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.List;

import lombok.Data;

/**
 * 
 * 用户上下文
 * @author 张三
 *
 */
@Data
public class UserContext implements Serializable{
	
	
	private static final long serialVersionUID = 1L;
	private String id;
	private String account;
	private String name;
	private String lastLoginIp;
	private String currentLoginIp;
	private LocalDateTime lastLoginTime;
	private LocalDateTime lastModifyPasswordTime;
	private String passwordPhone;
	private String passwordEmail;
	private String avatar;
	private String remark;
	private int flag;
	private String createUserId;
	private LocalDateTime createTime;
	
	
	public boolean isFirstLogin() {
		return this.lastLoginTime==null;
	}
	/**
	 * 获取当前登录用户的上下文
	 * @return
	 */
	public static UserContext getCurrent() {
		return UserContextHolder.get();
	}
	
	public static String getCurrentUserId() {
		return getCurrent().getId();
	}
	public static String getCurrentLoginIp() {
		return getCurrent().getCurrentLoginIp();
	}
}
